home *** CD-ROM | disk | FTP | other *** search
- import java.awt.event.KeyAdapter;
- import java.awt.event.KeyEvent;
- import java.util.EventObject;
-
- class Friends$TextFieldKey extends KeyAdapter {
- // $FF: synthetic field
- private final Friends this$Friends;
-
- public void keyPressed(KeyEvent event) {
- Object object = ((EventObject)event).getSource();
- if (object == this.this$Friends.textfield) {
- int key = event.getKeyCode();
- switch (key) {
- case 17:
- try {
- String text = this.this$Friends.textfield.getText();
- if (text == null) {
- return;
- }
-
- text = text.trim();
- if (text.equals("")) {
- return;
- }
-
- int p = text.length() - 1;
-
- while(text.charAt(p) != ' ') {
- --p;
- if (p < 0) {
- p = -1;
- break;
- }
- }
-
- text = text.substring(p + 1);
- int q = 0;
- int r = 0;
-
- for(int i = 0; i < this.this$Friends.list.getItemCount(); ++i) {
- if (this.this$Friends.list.getItem(i).startsWith(text)) {
- r = i;
- ++q;
- }
- }
-
- if (q == 1) {
- this.this$Friends.textfield.setText(this.this$Friends.textfield.getText().substring(0, p + 1) + this.this$Friends.list.getItem(r));
- this.this$Friends.textfield.setCaretPosition(this.this$Friends.textfield.getText().length());
- return;
- }
- break;
- } catch (Exception var11) {
- System.out.println("exception !! je capture");
- return;
- }
- case 38:
- try {
- if (this.this$Friends.count > 29) {
- return;
- }
-
- --this.this$Friends.lht;
- ++this.this$Friends.count;
- if (this.this$Friends.lht < 0) {
- if (this.this$Friends.history[29] != null) {
- this.this$Friends.lht = 29;
- } else {
- this.this$Friends.lht = 0;
- }
- }
-
- this.this$Friends.textfield.setText(this.this$Friends.history[this.this$Friends.lht]);
- this.this$Friends.textfield.setCaretPosition(this.this$Friends.textfield.getText().length());
- return;
- } catch (Exception var10) {
- System.out.println("exception !! je capture");
- return;
- }
- case 40:
- try {
- if (this.this$Friends.count - 1 == 0) {
- return;
- }
-
- ++this.this$Friends.lht;
- --this.this$Friends.count;
- if (this.this$Friends.lht > 29) {
- this.this$Friends.lht = 0;
- }
-
- if (this.this$Friends.lht == this.this$Friends.lh) {
- this.this$Friends.lht = this.this$Friends.lh - 1;
- }
-
- this.this$Friends.textfield.setText(this.this$Friends.history[this.this$Friends.lht]);
- this.this$Friends.textfield.setCaretPosition(this.this$Friends.textfield.getText().length());
- return;
- } catch (Exception var9) {
- System.out.println("exception !! je capture");
- return;
- }
- }
- }
-
- }
-
- Friends$TextFieldKey(Friends this$Friends) {
- this.this$Friends = this$Friends;
- this.this$Friends = this$Friends;
- }
- }
-